#pragma once
#include <vector>
#include "v8.h"

using namespace v8;


template <typename T>
class object_pool
{
public:
    object_pool()       {}
    ~object_pool()      { for(std::vector<T*>::iterator it = _pool.begin(); it != _pool.end(); ++ it) delete *it; _pool.clear(); }

    T*  new_object()    { T* t = new T; _pool.push_back(t); return t; }

private:
    std::vector<T*>      _pool;
};


void register_objects(Handle<ObjectTemplate>& templ);